import { post, get } from '@/request/http'
import store from '@/store'

//持箱人 船公司下拉框查询
export const getShips = () => {
  return post('/FTKJWLHYPT/base/tmShiplnesModelList', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {},
      },
    },
  })
}

//箱尺寸下拉框
export const GetContatinerSizes = () => {
  return post('/FTKJWLHYPT/dropDown/GetModelContatinerSizes', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {},
      },
    },
  })
}

//国家-省-市 级联查询
export const getCPC = () => get('/FTKJWLHYPT/dropDown/getCPC')

//港口下拉框查询
export const getPortsInfo = () => {
  return get('/FTKJWLHYPT/dropDown/getPortsInfo')
}

// 省管理  国家下拉框
export const provinceCityGj = data =>
  post('/FTKJWLHYPT/base/GetCouModelList', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          ctyCd: data.ctyCd,
          ctyCname: data.ctyCname,
          ctyEname: data.ctyCname,
        },
      },
    },
  })

// 市管理/区县管理 省下拉框
export const shengCityManagementXL = () =>
  post('/FTKJWLHYPT/base/getPro', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {},
      },
    },
  })
//供应商下拉框
export const companyListByType = () =>
  post('/FTKJWLHYPT/base/seletSysCompanyInfosByType', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {},
      },
    },
  })
//已审核供应商下拉框
export const companyListByStatus = () =>
  post('/FTKJWLHYPT/base/seletSysCompanyInfosByStatus', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {},
      },
    },
  })
//已审核供应商下拉框(当前供应商)
export const companyListByStatusGYS = () =>
  post('/FTKJWLHYPT/base/seletSysCompanyInfosByStatus', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          fltId: store.state.user.FLT_UUID_DX_H,
        },
      },
    },
  })
//区县管理 市下拉框
export const shiShippingCompany = data =>
  post('/FTKJWLHYPT/base/getCtiye', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          ctyeCode: data.ctyeCode,
          ctyeCityId: data.ctyeCityId,
        },
      },
    },
  })

//区域中心
export const getChildrenDptList = () => {
  return post('/FTKJWLHYPT/platform/getChildrenDptList', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          dptFltId: store.state.user.FLT_UUID_DX_H,
        },
      },
      Orderbys: {},
      PageIndexs: {
        FTKJWLHYPT: '',
      },
      PageSizes: {
        FTKJWLHYPT: '',
      },
    },
  })
}

//支付方式
export const zffs = () => {
  return post('/FTKJWLHYPT/base/getRefCodesByType', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          rvDomain: '支付方式_网络',
          rvTerId: store.state.user.FLT_UUID_DX_H,
        },
      },
    },
  })
}

//银行代码
export const bankCode = () => {
  return post('/FTKJWLHYPT/base/getRefCodesByType', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          rvDomain: '银行代码',
        },
      },
    },
  })
}

//准驾车型
export const carType = () => {
  return post('/FTKJWLHYPT/base/getRefCodesByType', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          rvDomain: '准驾车型',
        },
      },
    },
  })
}

//仲裁类型
export const arbitrationTypeBidding = () => {
  return post('/FTKJWLHYPT/base/getRefCodesByType', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          rvDomain: '仲裁类型',
        },
      },
    },
  })
}
//保证金类型
export const bondTypeBidding = () => {
  return post('/FTKJWLHYPT/base/getRefCodesByType', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          rvDomain: '保证金类型',
        },
      },
    },
  })
}
//类型
export const typeData = () => {
  return get('/FTKJWLHYPT/base/selectSyscompanyType', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {},
      },
    },
  })
}

//新港口下拉
export const XLSupplierCreation = () => {
  post('/FTKJWLHYPT/dropDown/getPortsInfoByDptId', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          potDptId: store.state.user.DPTID_DX_H,
          potFltId: store.state.user.FLT_UUID_DX_H, //车队id
        },
      },
    },
  })
}
//基础代码
export const getRefCodesByType = rvDomain => {
  return post('/FTKJWLHYPT/base/getRefCodesByType', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          rvDomain,
          // rvTerId: store.state.user.FLT_UUID_DX_H
        },
      },
    },
  })
}
//客户下拉 （旧客户）
export const getAuditUserList = () => {
  return post('/FTKJWLHYPT/base/getAuditUserToList', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          cltName: '',
        },
      },
      Orderbys: {},
      PageIndex: {
        FTKJWLHYPT: '',
      },
      PageSize: {
        FTKJWLHYPT: '',
      },
    },
  })
}
//客户下拉（糖厂、货主）
export const getSugarUserList = () => {
  return post('/FTKJWLHYPT/base/getAuditUserToList', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          fltUuid: store.state.user.FLT_UUID_DX_H,
        },
      },
    },
  })
}
/**
 * 供应商客户下拉（上面那个是老的）
 */

export const GYSClientList = ({ fltName = '', fltPorts = '', uuid, fltAuditstatus, PageIndex, PageSize }) =>
  post('/FTKJWLHYPT/system/querySysFleet', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          fltName,
          fltPorts,
          uuid,
          fltAuditstatus,
        },
      },
      Orderby: {},
      PageIndex: {
        FTKJWLHYPT: PageIndex,
      },
      PageSize: {
        FTKJWLHYPT: PageSize,
      },
    },
  })

//省-市-区  省
export const getProvince = () => {
  return post('/FTKJWLHYPT/dropDown/getProvince', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {},
      },
    },
  })
}

//省-市-区  市
export const getUrban = ({ prvCode }) => {
  return post('/FTKJWLHYPT/dropDown/getUrban', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          prvCode,
        },
      },
    },
  })
}

//省-市-区  区
export const getDistrict = ({ ctyeCode }) => {
  return post('/FTKJWLHYPT/dropDown/getDistrict', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          ctyeCode,
        },
      },
    },
  })
}

//省-市-区  市
export const getUrbanDemand = ({ dliSCity, dliDCity }) => {
  return post('/FTKJWLHYPT/dropDown/getUrbanDemand', {
    dliSCity,
    dliDCity,
  })
}
//省-市-区  区
export const getDistrictDemand = ({ dliSArea, dliDArea }) => {
  return post('/FTKJWLHYPT/dropDown/getDistrictDemand', {
    dliSArea,
    dliDArea,
  })
}
//已审核供应商下拉框
export const getSysCompanyInfo = ({ fltName, fltPorts, PageSizes, PageIndexs }) => {
  return post('/FTKJWLHYPT/dropDown/getSysCompanyInfo', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          fltName: fltName,
          fltPorts: fltPorts,
          fltDepId: store.state.user.DPTID_DX_H,
        },
        PageIndexs: {
          FTKJWLHYPT: PageIndexs,
        },
        PageSizes: {
          FTKJWLHYPT: PageSizes,
        },
      },
    },
  })
}

// 收货方下拉框接口
export const getReceiver = (cltId = '') => {
  return post('/FTKJWLHYPT/dropDown/findDrowdownreveivingpartyName', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          cltId,
        },
      },
    },
  })
}
// 获取 糖厂 下拉框
export const getShipper = () => {
  let dptFltId = store.state.user.FLT_UUID_DX_H
  return post('/FTKJWLHYPT/system/getShipper', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          dptFltId,
        },
      },
    },
  })
}

//获取供应商下拉
export const getSupplier = () =>
  post('/FTKJWLHYPT/system/querySysCompanyDto', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {},
      },
    },
  })

// 发货方下拉框接口
export const getSender = (cltId = '') => {
  return post('/FTKJWLHYPT/dropDown/findDrowdownorshippernName', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          cltId,
        },
      },
    },
  })
}
// 规格下拉框接口
export const getNormListDropDownSer = ({ fltUuid, depId }) => {
  return post('/FTKJWLHYPT/dropDown/getNormListDropDown', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          fltUuid,
          depId,
        },
      },
    },
  })
}
// 合同规格下拉框接口
export const getNormListDropDownSer1 = () => {
  return post('/FTKJWLHYPT/dropDown/getNormListDropDown', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          fltUuid: store.state.user.FLT_UUID_DX_H,
        },
      },
    },
  })
}
// 合同规格下拉框接口
export const getNormListDropDownSer2 = () => {
  return post('/FTKJWLHYPT/dropDown/getNormListDropDown', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          fltUuid: -1,
        },
      },
    },
  })
}
// 品牌下拉框接口
export const getBrandListDropDownSer = ({ fltId, dptId }) => {
  return post('/FTKJWLHYPT/dropDown/getBrandListDropDown', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          fltId,
          dptId,
        },
      },
    },
  })
}
// 产品大类下拉框接口
export const getProjectBigDropDownSer = ({ fltId, dptId }) => {
  return post('/FTKJWLHYPT/dropDown/getProjectBigDropDown', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          fltId,
          dptId,
        },
      },
    },
  })
}
// 品种下拉框接口
export const getVarietiesDefaultDropDownSer = ({ fltId, dptId }) => {
  return post('/FTKJWLHYPT/dropDown/getVarietiesDefaultDropDown', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          fltId,
          dptId,
        },
      },
    },
  })
}
// 历史起始地线路下拉
export const queryLineInfoHistorySite = ({}) => {
  return post('/FTKJWLHYPT/dropDown/queryLineInfoHistorySite', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          fltUuid: store.state.user.FLT_UUID_DX_H,
          dptId: store.state.user.DPTID_DX_H,
        },
      },
    },
  })
}
// 历史目的地线路下拉
export const queryLineInfoHistoryDestination = ({}) => {
  return post('/FTKJWLHYPT/dropDown/queryLineInfoHistoryDestination', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          fltUuid: store.state.user.FLT_UUID_DX_H,
          dptId: store.state.user.DPTID_DX_H,
        },
      },
    },
  })
}

// 车牌号下拉
export const queryTrkNoList = () => post('/FTKJWLHYPT/dropDown/queryTrkNoList', {})

// 司机名称下拉
export const queryDvrNameList = () => post('/FTKJWLHYPT/dropDown/queryDvrNameList', {})

/**
 * 省市区县查询，返回树
 * @returns {Promise | Promise<unknown>}
 */
export const queryProvinceCityTree = () => post('/FTKJWLHYPT/dropDown/queryProviceCityTree', {})

export const checkDemandCode = ({ code }) => get('/FTKJWLHYPT/dropDown/queryLineInfoHistoryDestination/' + code)

export const getBizNo = () => get('/FTKJWLHYPT/bond/genBizNo')
